package com.mmzssblog;

import com.mmzssblog.wordcloud.CreateWordCloudByArrayService;
import com.mmzssblog.wordcloud.CreateWordCloudByFileService;

import java.io.File;
import java.io.IOException;

/**
 * @author ：mmzsblog.cn
 * @date ：Created in 2021/11/30 14:40
 * @description：测试效果
 * @modified By：
 * @version:
 */
public class TestResult {

    public static void main(String[] args) {
        String outputDir = "";
        try {
            File file = new File("");
            outputDir = file.getCanonicalPath().replace("\\", "/") + "/src/main/java";
        } catch (IOException e) {
            e.printStackTrace();
        }

        // 通过数组随机生成
        CreateWordCloudByArrayService createWordCloudByArrayService = new CreateWordCloudByArrayService();
        try {
            createWordCloudByArrayService.generate(outputDir + "/result.png");
        } catch (IOException e) {
            e.printStackTrace();
        }

        // 通过指定文件生成
        CreateWordCloudByFileService createWordCloudByFileService = new CreateWordCloudByFileService();
        try {
            createWordCloudByFileService.generate(outputDir + "/original.txt",outputDir + "/result2.png",outputDir + "/share.png");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
